var toast = function (msg, duration, color) {
  duration = isNaN(duration) ? 3000 : duration;
  var m = document.createElement("span");
  m.innerHTML = msg;
  let height = "36px";
  let radius = "22px";
  let bgColor = color || "green";
  m.style.cssText = `opacity: 0.7;height: ${height};color: white;border-radius: ${radius};
  line-height: ${height};text-align: center;padding:2px 20px;margin:auto;
  background: ${bgColor};font-size: 16px;minWidth:80px;`;
  let container = document.createElement("div");
  container.style.cssText = `height:${height};display: flex;justify-content: center;flex-direction: row-reverse;
  width:100%;position: fixed;top: 60%;left:0;z-index: 999999;`;
  container.append(m);
  document.body.appendChild(container);
  setTimeout(function () {
    var d = 0.5;
    m.style.webkitTransition =
      "-webkit-transform " + d + "s ease-in, opacity " + d + "s ease-in";
    m.style.opacity = "0";
    setTimeout(function () {
      document.body.removeChild(container);
    }, d * 1000);
  }, duration);
};
export { toast };
